package cn.com.jslh.boarpro.main.view;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.com.jslh.boarpro.R;
import cn.com.jslh.boarpro.main.contract.SearchItemInfoContract;
import cn.com.jslh.boarpro.main.presenter.SearchItemInfoPresenterImpl;
import cn.com.jslh.boarpro.util.DividerGridItemDecoration;

public class SearchItemInfoActivity extends AppCompatActivity implements SearchItemInfoContract.View {

    @BindView(R.id.recycleview)
    RecyclerView recycleview;
    private SearchItemInfoContract.Presenter presenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search_item_info);
        ButterKnife.bind(this);
        GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 2);
        recycleview.addItemDecoration(new DividerGridItemDecoration(this));
        recycleview.setLayoutManager(gridLayoutManager);
        presenter = new SearchItemInfoPresenterImpl(this, this);
        presenter.bindRV(recycleview);
        presenter.setFid(getIntent().getStringExtra("fid"));
        presenter.start();
    }

    @OnClick(R.id.back)
    public void onViewClicked() {
        SearchItemInfoActivity.this.finish();
    }

    @Override
    public void setPresenter(SearchItemInfoContract.Presenter presenter) {
        this.presenter = presenter;
    }
}
